package com.cwd.yg.service.impl;

import com.cwd.yg.dao.ScheduleDao;
import com.cwd.yg.pojo.Schedule;
import com.cwd.yg.pojo.TimeTable;
import com.cwd.yg.service.ScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * @Description：ScheduleServiceImpl
 * @Author ：Cwd
 * @Date ：2022/2/7 14:55
 */
@Service
public class ScheduleServiceImpl implements ScheduleService {

    @Autowired
    private ScheduleDao scheduleDao;

    @Override
    public List<Schedule> queryAll() {
        List<Schedule> timeTables = Optional
                .ofNullable(scheduleDao.queryAll())
                .orElse(Collections.emptyList());
        return timeTables.stream()
                .collect(Collectors.toList());
    }
}
